package com.gkh.sqlparser;

public abstract class TokenStr {

	String str;
	String wstr;

	int len;
	TokenStr prev;
	TokenStr next;

	public TokenStr() {
		len = 0;
		prev = null;
		next = null;
	}

	public TokenStr(char[] s, char[] w, int l) {
		Set(s, w, l);
		prev = null;
		next = null;
	}

	public TokenStr(char[] s) {
		if (s != null)
			Set(s, null, s.length);
		prev = null;
		next = null;
	}

	public TokenStr(String s) {
		Set(s.toCharArray(), null, s.length());
		prev = null;
		next = null;
	}

	public TokenStr(Token token) {

	}

	abstract void Set(char[] str, char[] wstr, int len);

	abstract void Set(TokenStr src);

	String GetCStr() {
		return str;
	}

	// Append a string
	abstract void Append(char[] str, char[] wstr, int len);

	abstract void Append(Token token, int start, int len);

	abstract void Append(Token token, boolean appendSource);

	abstract void Append(TokenStr str);

	abstract void Append(TokenStr str, int start, int len);

	abstract void Append(int num);

	void Clear() {
		str = "";
		wstr = "";
		len = 0;
	}

	abstract boolean Compare(char[] word, char[] w_word, int len);

	abstract boolean Compare(char ch, char wch, int pos);

	abstract boolean Compare(TokenStr first, TokenStr second);

	abstract boolean Compare(TokenStr tokenstr, char[] word, char[] w_word, int len);

	abstract boolean Compare(TokenStr tokenstr, char ch, char wch, int pos);

}
